const express = require('express');
const router = express.Router();
const favoriteDao = require('../dao/favoriteDao');

// 添加收藏
router.post('/add', async (req, res) => {
    try {
        await favoriteDao.addFavoriteDao(req, res);
    } catch (error) {
        res.status(500).send({ status: 0, message: 'error', errorMessage: error.message });
    }
});

// 删除收藏
router.delete('/delete', async (req, res) => {
    try {
        await favoriteDao.deleteFavoriteDao(req, res);
    } catch (error) {
        res.status(500).send({ status: 0, message: 'error', errorMessage: error.message });
    }
});

// 获取收藏列表
router.get('/list', async (req, res) => {
    try {
        await favoriteDao.findFavoriteDao(req, res);
    } catch (error) {
        res.status(500).send({ status: 0, message: 'error', errorMessage: error.message });
    }
});

module.exports = router;